package com.main.organizationandplatformmanagement.interfaces.assembler;

import com.main.common.base.base.BaseAssembler;
import com.main.common.base.base.BaseAssemblerFactory;
import com.main.organizationandplatformmanagement.domain.organization.entity.Organization;
import com.main.organizationandplatformmanagement.domain.organization.entity.OrganizationModel;
import com.main.organizationandplatformmanagement.interfaces.dto.AddOrganizationDTO;
import com.main.organizationandplatformmanagement.interfaces.dto.AddOrganizationModelDTO;
import jakarta.validation.constraints.NotNull;


public class OrganizationModelAssembler {
    private final BaseAssembler<OrganizationModel, AddOrganizationModelDTO> baseAssembler;

    public OrganizationModelAssembler(@NotNull BaseAssemblerFactory baseAssemblerFactory) {
        this.baseAssembler = baseAssemblerFactory.getService(AddOrganizationModelDTO.class);
    }

    public OrganizationModel toEntity(AddOrganizationModelDTO addOrganizationModelDTO) {
        OrganizationModel organizationModel = new OrganizationModel();
        organizationModel = baseAssembler.toEntity(addOrganizationModelDTO, organizationModel);
        organizationModel.setOrganizationId(addOrganizationModelDTO.getOrganizationId());
        organizationModel.setAtomicId(addOrganizationModelDTO.getAtomicId());
        organizationModel.setParentAtomicId(addOrganizationModelDTO.getParentAtomicId());
        return organizationModel;
    }

}